package com.blrs.service.procure.impl;

import java.util.List;

import com.blrs.common.utils.ReflectionUtils;
import com.blrs.service.procure.IProcureCooperateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.blrs.mapper.ProcureCooperateMapper;
import com.blrs.domain.ProcureCooperate;

/**
 * 采购与合作Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-08-01
 */
@Service
public class ProcureCooperateServiceImpl implements IProcureCooperateService
{
    @Autowired
    private ProcureCooperateMapper procureCooperateMapper;

    /**
     * 查询采购与合作
     * 
     * @param id 采购与合作主键
     * @return 采购与合作
     */
    @Override
     public ProcureCooperate selectProcureCooperateById(Long id)
    {
        return procureCooperateMapper.selectProcureCooperateById(id);
    }

    /**
     * 查询采购与合作列表
     * 
     * @param procureCooperate 采购与合作
     * @return 采购与合作
     */
    @Override
    public List<ProcureCooperate> selectProcureCooperateList(ProcureCooperate procureCooperate)
    {
        return procureCooperateMapper.selectProcureCooperateList(procureCooperate);
    }

    /**
     * 新增采购与合作
     * 
     * @param procureCooperate 采购与合作
     * @return 结果
     */
    @Override
    public int insertProcureCooperate(ProcureCooperate procureCooperate)
    {
        return procureCooperateMapper.insertProcureCooperate(procureCooperate);
    }

    /**
     * 修改采购与合作
     * 
     * @param procureCooperate 采购与合作
     * @return 结果
     */
    @Override
    public int updateProcureCooperate(ProcureCooperate procureCooperate)
    {
        try {
            ReflectionUtils.setCommonPrivateProperty(procureCooperate);
        } catch (Exception e) {
            throw new RuntimeException("注入异常");
        }
        return procureCooperateMapper.updateProcureCooperate(procureCooperate);
    }

    /**
     * 批量删除采购与合作
     * 
     * @param ids 需要删除的采购与合作主键
     * @return 结果
     */
    @Override
    public int deleteProcureCooperateByIds(Long[] ids)
    {
        return procureCooperateMapper.deleteProcureCooperateByIds(ids);
    }

    /**
     * 删除采购与合作信息
     * 
     * @param id 采购与合作主键
     * @return 结果
     */
    @Override
    public int deleteProcureCooperateById(Long id)
    {
        return procureCooperateMapper.deleteProcureCooperateById(id);
    }
}
